#coding=utf-8
import scrapy
from scrapy.spiders import CrawlSpider
from scrapy.selector import Selector
from scrapy.http import Request
import urllib

class AHospitalSpider(CrawlSpider):
    name='a_hospital'   #runtime name
    start_urls=['http://www.a-hospital.com/w/%E9%A6%96%E9%A1%B5']
    url = 'http://www.a-hospital.com/w/'

    def parse(self, response):
        selector = Selector(response)
        articles = selector.xpath('')

        for article in articles:
            print()

        next_link = selector.xpath('//*[@id="list-container"]/div/button/@data-url').extract()

        if len(next_link) == 1:
            next_link = self.url + str(next_link[0])
            print("----" + next_link)
            yield Request(next_link, callback=self.parse)